	layui.use('layer', function() {
		var layer = layui.layer;

	});
	//键盘enter事件
	$(document).on("keydown", function(event) {
		var e = event || window.event || arguments.callee.caller.arguments[0];
		if(e && e.keyCode == 13) {
			Login();
		}
	});
	//登录操作
	function Login() {
		var username = $('.username').val();
		var passward = $('.passward').val();

		if(username != '') {
			if(passward != '') {
				$.post("/api/admin/v1/adminlogin.action", {
					'acc': username,
					'pass': passward
				}, function(data) {

					if(data.code == 0 && data.adminkey == 0) {
						layer.msg(data.msg);
						setInterval(function() {
							window.location.href = 'administorZhu.html'
						}, 1000);
					} else if(data.code == 0 && data.adminkey == 1) {
						layer.msg(data.msg);
						setInterval(function() {
							window.location.href = 'applyZi.html'
						}, 1000);

					} else {
						layer.msg(data.msg)
					}

				})
			} else {
				layer.msg('请输入密码')
			}
		} else {
			layer.msg('请输入账号')
		}

	}

	$('.login').on('click', function() {

		Login();
	});